home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 101-125 / disk_108 / dots-perfect / dospecial.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  125 lines

  1. /* DotsPerfect-MX80 special commands */
  2.  
  3. #include    "exec/types.h"
  4. #include    "devices/printer.h"
  5. #include    "devices/prtbase.h"
  6.  
  7. extern struct PrinterData *PD ;
  8.  
  9. DoSpecial(command,OutputBuffer,vline,currentVMI,crlfFlag,Parms)
  10.  
  11. UWORD *command ;    /* command number as defined in printer.h */
  12. char OutputBuffer[] ;    /* buffer into which to return converted command */
  13. BYTE *vline ;        /* value of the current line position */
  14. BYTE *currentVMI ;    /* value of the current line spacing */
  15. BYTE *crlfFlag ;    /* setting of the add <lf> after <cr> flag */
  16. UBYTE Parms[] ;        /* parameters that came with ANSI command */
  17. {
  18.     int i = 0 ;
  19.     int x = 0 ;
  20.     BOOL DoubleStrike;
  21.     static char
  22.      initPrinter[]="\x1bx0\x1b2\x12\x1b5\x1b-\xfe\x1bF\x0d\x1bH\x1bW\xfe";
  23.     static char
  24.      initMarg[]="\xfd\x1bQ\x50\xfd";
  25.     if (*command == aRIN )
  26.     {
  27.         /* initialize output buffer */
  28.         while(x < 19) { OutputBuffer[x] = initPrinter[x] ; x++ ; }
  29.         OutputBuffer[10] = '\000';
  30.         OutputBuffer[18] = '\000';
  31.         if((PD->pd_Preferences.PrintQuality) == LETTER)
  32.             OutputBuffer[2] = '1';
  33.  
  34.         *currentVMI = 36; /* initially 1/6" line spacing */
  35.         if ( (PD->pd_Preferences.PrintSpacing) == EIGHT_LPI )
  36.             {
  37.             OutputBuffer[4] = '0' ;
  38.             *currentVMI = 27;
  39.             }
  40.  
  41.         if ( (PD->pd_Preferences.PrintPitch) == FINE )
  42.             OutputBuffer[5] = '\x0f' ;
  43.  
  44.         Parms[0] = (PD->pd_Preferences.PrintLeftMargin);
  45.         Parms[1] = (PD->pd_Preferences.PrintRightMargin);
  46.         *command = aSLRM;
  47.     }
  48.  
  49. /* Set left and right margins */
  50. /* Actually only right margin set as this printer cannot set left margin */
  51.  
  52.     if(*command == aSLRM)
  53.         {
  54.         PD->pd_PWaitEnabled = 253;
  55.         initMarg[3] = Parms[1];
  56.         while( i < 5 ) OutputBuffer[x++] = initMarg[i++];        
  57.         return(x);
  58.         }
  59.  
  60.     if(*command == aDEN4) DoubleStrike = TRUE;
  61.  
  62.     if(*command == aDEN3) DoubleStrike = FALSE;
  63.  
  64.     if(*command == aSHORP3)
  65.         {
  66.         OutputBuffer[x++] = '\x12'; /* Turn off condensed mode */
  67.         OutputBuffer[x++] = '\x1b'; /* Reset right margin after... */
  68.         OutputBuffer[x++] = 'Q';    /* ....stopping condensed mode */
  69.         OutputBuffer[x++] = initMarg[3];
  70.         return(x);
  71.         }
  72.  
  73.     if(*command == aPLU)
  74.         {
  75.         if((*vline)==0) {(*vline)=1; *command=aSUS2; return(0);}
  76.         if((*vline)<0) {(*vline)=0; *command=aSUS3; return(0);}
  77.         return(-1);
  78.         }
  79.     if(*command == aPLD)
  80.         {
  81.         if((*vline)==0) {(*vline)=(-1); *command=aSUS4; return(0);}
  82.         if((*vline)>0) {(*vline)=0; *command=aSUS1; return(0);}
  83.         return(-1);
  84.         }
  85.  
  86.     if(*command == aSUS0)
  87.         {
  88.         if(DoubleStrike == FALSE) *command = aDEN3; /* Turn off... */
  89.         *vline = 0; /*..doublestrike if it's not supposed to be on */
  90.         }
  91.  
  92.     if(*command == aSUS1)
  93.         {
  94.         if(DoubleStrike == FALSE) *command = aDEN3; /* Turn off... */
  95.         *vline = 0; /*..doublestrike if it's not supposed to be on */
  96.         }
  97.  
  98.     if(*command == aSUS2) *vline = 1;
  99.  
  100.     if(*command == aSUS3)
  101.         {
  102.         if(DoubleStrike == FALSE) *command = aDEN3;
  103.         *vline = 0;
  104.         }
  105.  
  106.     if(*command == aSUS4) *vline = (-1);
  107.  
  108.     if(*command == aVERP0) *currentVMI = 27;
  109.  
  110.     if(*command == aVERP1) *currentVMI = 36;
  111.  
  112.     if(*command == aIND)
  113.         {
  114.         OutputBuffer[x++] = '\x1b';
  115.         OutputBuffer[x++] = 'J';
  116.         OutputBuffer[x++] = *currentVMI;
  117.         return(x);
  118.         }
  119.     if(*command == aRIS) PD->pd_PWaitEnabled = 253;
  120.     
  121. /* other special functions would follow here */
  122.  
  123.     return(0) ;
  124. }
  125.